package com.wzy.content.api;

import com.wzy.content.model.po.CourseTeacher;
import com.wzy.content.service.CourseTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author wzy
 * @Date 2024/1/1 18:58
 * @description: 课程老师相关接口
 */
@Api(value = "课程老师管理相关接口",tags = "课程老师管理相关接口")
@RestController
public class CourseTeacherController {
    @Autowired
    private CourseTeacherService courseTeacherService;
    @ApiOperation("查询老师接口")
    @GetMapping("/courseTeacher/list/{courseId}")
    public List<CourseTeacher> getCourseTeacher(@PathVariable Long courseId){
        return courseTeacherService.getListCourseTeacher(courseId);
    }

    @ApiOperation("新增和修改教师接口")
    @PostMapping("/courseTeacher")
    public CourseTeacher saveAndUpdateCourseTeacher(@RequestBody CourseTeacher courseTeacher){
        //机构id，由于认证系统没有上线暂时硬编码
        Long companyId = 1232141425L;
        CourseTeacher courseTeacherInfo = courseTeacherService.saveAndUpdateCourseTeacher(companyId,courseTeacher);
        return courseTeacherInfo;

    }

    @ApiOperation("删除老师接口")
    @DeleteMapping("/courseTeacher/course/{courseId}/{teacherId}")
    public void deleteCourseTeacher(@PathVariable Long courseId,@PathVariable Long teacherId){
        Long companyId = 1232141425L;
        courseTeacherService.deleteCourseTeacher(companyId,courseId,teacherId);
    }
}
